﻿@model Bricks.Site.Models.UserView

@{
    ViewBag.Title = "用户编辑";
    //Layout = "~/Views/Shared/_UserPage.cshtml";
}
@*<script src="~/Res/kindeditor/kindeditor-all-min.js"></script>*@  <!--引入KindEditor的JS-->

<script type="text/javascript">
    //$(function () {
    //    //$.EditorInit("#richEditor", 500, "p", true);  //初始化KindEditor
    //})

    $(function () {
        initTable();
    });

    function initTable(queryData) {
        $('#userOrgTreeGrid').treegrid({   //定位到Table标签，Table标签的ID是myDataGrid
            //   ActionInfo是控制器，GetData是控制器中获取用户数据的一个Action
            url: '/Account/GetUserOrgs',   //指向后台的Action来获取当前用户的信息的Json格式的数据
            //title: '用户管理',  //标识
            //iconCls: 'icon-save',
            //width: 'auto',
            //height: 500,
            nowrap: true,
            autoRowHeight: false,
            striped: true,
            collapsible: true,
            pagination: false,
            pageSize: 20,
            rownumbers: true,
            //sortName: 'ID',    //根据某个字段给easyUI排序
            //sortOrder: 'asc',
            remoteSort: false,
            idField: 'ID',
            treeField: 'OrgName',
            parentField: 'PID',
            checkOnSelect: false,
            selectOnCheck: false,
            singleSelect: false,
            queryParams: queryData,  //异步查询的参数
            columns: [[
                { field: 'ck', checkbox: true },   //选择
                { title: '机构名称', field: 'OrgName', width: 175, sortable: false },
                {
                    title: '权限管理员', field: 'IsPurviewAdmin', width: 70, sortable: false, align: 'center',
                    formatter: function (value, row, index) {
                        if (value == true) {
                            return '<input type="checkbox" checked="true" />';
                        }
                        else {
                            return '<input type="checkbox" />';
                        }
                    }
                },
                {
                    title: '分发管理员', field: 'IsHandoutAdmin', width: 70, sortable: false, align: 'center',
                    formatter: function (value, row, index) {
                        if (value == true) {
                            return '<input type="checkbox" checked="true" />';
                        }
                        else {
                            return '<input type="checkbox" />';
                        }
                    }
                }
            ]]
        });
    }
</script>

@*<textarea id="richEditor" name="Content">richEditor Content</textarea>*@  <!--Textarea文本框-->

<table>
    <tr>
        <!--左边为用户信息-->
        <td>
            <div region="west" data-options="border:false" style="width:345px;">
                <div class="easyui-panel" title="用户信息">
                    <div class="frombox datagrid-body" style="padding-bottom:5px;">
                        <form id="form-model" method="post">
                            <table class="datagrid-btable" border="0" cellspacing="0" cellpadding="0" width="100%">
                                <tr class="datagrid-row">
                                    <td class="th">
                                        <div class="datagrid-cell">用户名</div>
                                    </td>
                                    <td class="td">
                                        <div class="datagrid-cell">
                                            <input name="UserName" class="easyui-textbox" data-options="required:true" value="@Model.UserName" />
                                        </div>
                                    </td>
                                </tr>
                                <tr class="datagrid-row">
                                    <td class="th">
                                        <div class="datagrid-cell">密码</div>
                                    </td>
                                    <td class="td">
                                        <div class="datagrid-cell">
                                            <input name="Password" class="easyui-textbox" value="@Model.Password" />
                                        </div>
                                    </td>
                                </tr>
                                <tr class="datagrid-row">
                                    <td class="th">
                                        <div class="datagrid-cell">确认密码</div>
                                    </td>
                                    <td class="td">
                                        <div class="datagrid-cell">
                                            <input name="ConfirmPassword" class="easyui-textbox" value="@Model.ConfirmPassword" />
                                        </div>
                                    </td>
                                </tr>
                                <tr class="datagrid-row">
                                    <td class="th">
                                        <div class="datagrid-cell">姓名</div>
                                    </td>
                                    <td class="td">
                                        <div class="datagrid-cell">
                                            <input name="RealName" class="easyui-textbox" value="@Model.RealName" />
                                        </div>
                                    </td>
                                </tr>
                                <tr class="datagrid-row">
                                    <td class="th">
                                        <div class="datagrid-cell">邮箱</div>
                                    </td>
                                    <td class="td">
                                        <div class="datagrid-cell">
                                            <input name="Email" class="easyui-textbox" value="@Model.Email" />
                                        </div>
                                    </td>
                                </tr>
                                <tr class="datagrid-row">
                                    <td class="th">
                                        <div class="datagrid-cell">联系电话</div>
                                    </td>
                                    <td class="td">
                                        <div class="datagrid-cell">
                                            <input name="Contactphone" class="easyui-textbox" value="@Model.Contactphone" />
                                        </div>
                                    </td>
                                </tr>
                                <tr class="datagrid-row">
                                    <td class="th">
                                        <div class="datagrid-cell">用户类型</div>
                                    </td>
                                    <td class="td">
                                        <div class="datagrid-cell">
                                            <input id="UserTypeNum" name="UserTypeNum" class="easyui-combobox" value="@Model.UserTypeNum" />
                                        </div>
                                    </td>
                                </tr>
                                <tr class="datagrid-row">
                                    <td class="th">
                                        <div class="datagrid-cell">描述</div>
                                    </td>
                                    <td class="td">
                                        <div class="datagrid-cell">
                                            <input name="Description" class="easyui-textbox" value="@Model.Description" />
                                        </div>
                                    </td>
                                </tr>
                                <tr class="datagrid-row">
                                    <td class="th">
                                        <div class="datagrid-cell">禁用</div>
                                    </td>
                                    <td class="td">
                                        <div class="datagrid-cell">
                                            @*<input name="IsDeleted" type="checkbox" checked="@Model.IsDeleted" />*@
                                            @Html.EditorFor(m => m.IsDeleted)
                                        </div>
                                    </td>
                                </tr>
                                <tr class="datagrid-row">
                                    <td class="th">
                                        <div class="datagrid-cell">提示</div>
                                    </td>
                                    <td class="td">
                                        <div class="datagrid-cell">
                                            <label style="color:blue;">编辑状态下，密码为空则不修改密码</label>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <input id="ID" name="ID" type="hidden" value="@Model.ID" />
                            <input name="AddDate" type="hidden" value="@Model.AddDate" />
                        </form>
                    </div>
                </div>
            </div>
        </td>

        <!--右边为机构数表，可勾选用户所属机构和勾选对应权限-->
        <td>
            <div region="center" style="border-left: 0px; width: 380px;height:387px;">
                <div class="easyui-panel" title="所属机构设置">
                    @*<table id="userOrgTreeGrid" fit="true"></table>*@
                    <table id="userOrgTreeGrid" style="height:358px;"></table>
                </div>
            </div>
        </td>
    </tr>
</table>